{% do load_script('category/nav') %}
{% set nextCode = '' %}
<div class="es-tabs" style="margin-top: 0px;">

  <div class="tab-header">
    <ul class="clearfix">
	{% if searchargs %}
      <!-- <li class="{% if category == '' %}active{% endif %}"><a href="{{ path(path, {category:'',tags:searchargs,fliter:fliter,orderBy:orderBy}) }}">全部</a></li> -->
	{% elseif searchargs == '' %}
      <!-- <li class="{% if category == '' %}active{% endif %}"><a href="{{ path(path, {category:'',fliter:fliter,orderBy:orderBy}) }}">全部</a></li> -->
	{% endif %}
      {% for cateogory in rootCategories %}
	    {% if searchargs %}
        <li class="{% if cateogory.id in activeIds %}{% set nextCode = cateogory.code %}active{% endif %}"><a href="{{ path(path, {category:cateogory.code,tags:searchargs,fliter:fliter,orderBy:orderBy}) }}">{{ cateogory.name }}</a></li>
		{% else %}
		<li class="{% if cateogory.id in activeIds %}{% set nextCode = cateogory.code %}active{% endif %}"><a href="{{ path(path, {category:cateogory.code,fliter:fliter,orderBy:orderBy}) }}">{{ cateogory.name }}</a></li>
		{% endif %}
      {% endfor %}
    </ul>
  </div>

  
  {% if categories %}
    <div class="tab-body">
      {% for l,cs in categories if cs %}
        <ul class="clearfix">
          {% for c in cs %}
            {% if loop.index == 1 %}
			
			  {% if searchargs %}
              <!-- <li class="all"><a href="{{ path(path, {category:nextCode,tags:searchargs,fliter:fliter,orderBy:orderBy}) }}">全部</a></li> -->
			  {% else %}
              <!-- <li class="all"><a href="{{ path(path, {category:nextCode,fliter:fliter,orderBy:orderBy}) }}">全部</a></li> -->
			  {% endif %}
			  
            {% endif %}
			
			{% if searchargs %}
            <li class="{% if c.id in activeIds %}{% set nextCode = c.code %}active{% endif %}"><a href="{{ path(path, {category:c.code,tags:searchargs,fliter:fliter,orderBy:orderBy}) }}" style="padding: 7px 30px;">{{ c.name }}</a></li>
			{% else %}
            <li class="{% if c.id in activeIds %}{% set nextCode = c.code %}active{% endif %}"><a href="{{ path(path, {category:c.code,fliter:fliter,orderBy:orderBy}) }}" style="padding: 7px 30px;">{{ c.name }}</a></li>
			{% endif %}
          {% endfor %}
        </ul>
      {% endfor %}
    </div>
  {% endif %}
</div>